class MyStorage {
  static setItem (key, value) {
    let $value = {time: Date.now(), value}
    return localStorage.setItem(key, JSON.stringify($value))
  }

  static getItem (key, def) {
    let v = JSON.parse(localStorage.getItem(key))
    return v ? v.value : def
  }

  static removeItem (key) {
    return localStorage.removeItem(key)
  }

  static clear () {
    return localStorage.clear()
  }
}

export default (Vue, option) => {
  window.myStorage = MyStorage
}
